<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions">


    <body background="../resources/images/table/bg.jpg">

        <ui:composition template="./UserTemplate.xhtml">
            <ui:define name="content">
                <p:panel header="Now showing">
                    <p:carousel value="#{UsereventBean.listAvailableEvent()}"
                                var="item"
                                rows="5"
                                itemStyleClass="eventClass"
                                effect="easeInStrong">
                        <c:set var="title" value="${item.eventTitle}"/>
                        <h:panelGrid columns="1" style="width:100%" cellpadding="5">
                            <h:commandLink action="ViewDetails" >
                                <p:graphicImage width="180" height="269" value="#{item.eventImg}"/>
                                <f:setPropertyActionListener value="#{item}" target="#{UsereventBean.selectev}" />
                            </h:commandLink>
                            <h:commandLink value="${fn:substring(title,0,20)}" style="color: red" action="ViewDetails">
                                <f:setPropertyActionListener value="#{item}" target="#{UsereventBean.selectev}" />
                            </h:commandLink>
                            <h:outputText value="Category: #{item.category.categoryName}" />

                            <h:outputText value="#{item.releaseDate}" style="color: #66ccff">
                                <f:convertDateTime pattern="dd/MM/yyyy"/>
                            </h:outputText>
                            <h:commandLink title="Buy a ticket" action="Tickets">
                                <h:graphicImage value="../resources/images/User/buy-ticket-button.png"/>
                            </h:commandLink>
                           
                        </h:panelGrid>
                    </p:carousel>
                </p:panel>
                <p:panel header="Coming up">
                    <p:carousel value="#{UsereventBean.listNextEvent()}"
                                var="item"
                                rows="5"
                                itemStyleClass="eventClass"
                                effect="easeInStrong">
                        <c:set var="title" value="${item.eventTitle}"/>
                        <h:panelGrid columns="1" style="width:100%" cellpadding="5">
                            <p:commandLink action="eventDetail" title="View Detail">
                                <p:graphicImage width="180" height="269" value="#{item.eventImg}"/>
                                <f:setPropertyActionListener value="#{item}" target="#{UsereventBean.event}" />
                            </p:commandLink>

                            <p:commandLink style="color: red" value="${fn:substring(title,0,20)}">

                            </p:commandLink>

                            <h:outputText value="Category: #{item.category.categoryName}" />

                            <h:outputText value="#{item.releaseDate}" style="color: #66ccff">
                                <f:convertDateTime pattern="dd/MM/yyyy"/>
                            </h:outputText>
                            <h:commandLink title="Buy a ticket" action="Tickets">
                                <h:graphicImage value="../resources/images/User/buy-ticket-button.png"/>
                            </h:commandLink>
                        </h:panelGrid>
                    </p:carousel>
                </p:panel>
            </ui:define>
        </ui:composition>

    </body>
</html>
